<a class="base-type-btn base-type-btn-blue"  onclick="callpay()" style="cursor: pointer;">支付</a>
    <script type="text/javascript">
        //调用微信JS api 支付
        function jsApiCall(json,id)
        {
            WeixinJSBridge.invoke('getBrandWCPayRequest',json,function(res){
                alert(res.err_code+res.err_desc+res.err_msg);

            });
        }

        function callpay(id)
        {

                    $.ajax({
                        url: "/wx/index.php?order_no="+order_no+"&total_fee="+total_fee,
                        success: function(data){
                            var json = eval('(' + data + ')');
                            if (typeof WeixinJSBridge == "undefined"){
                                if( document.addEventListener ){
                                    document.addEventListener('WeixinJSBridgeReady', jsApiCall(json,id), false);
                                }else if (document.attachEvent){
                                    document.attachEvent('WeixinJSBridgeReady', jsApiCall(json,id));
                                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall(json,id));
                                }
                            }else{
                                jsApiCall(json,id);
                            }
                        }
                    });
        }
    </script>